import java.util.Scanner;

/**
 * @Author: 唐文涛
 * @CreateTime: 2024-11-10
 * @Description: 测试
 * @Version: 1.0
 */


public class Main {


    public static void main(String[] args) {
        Scanner Scanner = new Scanner(System.in);

        while (true) {
            System.out.println("请选择要计算成绩的项目：");
            System.out.println("1.肺活量 2.50米跑 3.坐位体前屈 4.立定跳远 5.引体向上 6.仰卧起坐 7.800米跑 8.1000米跑 0.退出");
            int input = Scanner.nextInt();
            System.out.println("请输入性别：1.男 2.女");
            int sex = Scanner.nextInt();
            System.out.println("请输入年级：1.大一 2.大二 3.大三 4.大四");
            int grade = Scanner.nextInt();
            System.out.println("请输入要计算的数据：(时间请以秒为单位)");

            double data = Scanner.nextDouble();
            boolean isMale = isMale(sex);
            boolean isOneTwo = isOneTwo(grade);

            switch (input) {
                case 0:
                    return;
                case 1:
                    System.out.println(ScoreCalculator.calculateLungCapacityScore(data, isMale, isOneTwo));
                    break;
                case 2:
                    System.out.println(ScoreCalculator.calculateFiftyMeterRunScore(data, isMale, isOneTwo));
                    break;
                case 3:
                    System.out.println(ScoreCalculator.calculateSitAndReachScore(data, isMale, isOneTwo));
                    break;
                case 4:
                    System.out.println(ScoreCalculator.calculateStandingLongJumpScore(data, isMale, isOneTwo));
                    break;
                case 5:
                    System.out.println(ScoreCalculator.calculatePullUpsScore((int)data,isOneTwo));
                    break;
                case 6:
                    System.out.println(ScoreCalculator.calculateOneMinuteSitUpsScore((int)data, isOneTwo));
                    break;
                case 7:
                    System.out.println(ScoreCalculator.calculateEightHundredMeterRunScore((int)data,  isOneTwo));
                    break;
                case 8:
                    System.out.println(ScoreCalculator.calculateOneThousandMeterRunScore((int)data, isOneTwo));
                    break;
                default:
                    System.out.println("输入错误，请重新输入");
            }
        }
    }


    //根据sex传入的值判断性别
    public static boolean isMale(int sex) {
        return sex == 1;
    }

    //根据grade传入的值判断年级
    public static boolean isOneTwo(int grade) {
        return grade == 1 || grade == 2;
    }
}

